<?php
/**
 * Created by PhpStorm.
 * User: wanghaibo
 * Date: 17/5/8
 * Time: 14:28
 */

namespace Wx\Controller;



use Common\Controller\HomebaseController;

class ServiceController extends HomebaseController
{
    static $obj;
    public function index(){
        if(IS_AJAX){
            C('TOKEN_ON',false);
        }
        M('test')->add(array('sss'=>21));
//        $s = file_get_contents('http://jjc.woxuewangs.com/');
        $this->getObj();
        $this->obj->valid();
    }
    public function getObj(){
        $opt =C('WX_CONFIG');
        $opt = array(
            'token'=>$opt['token'], //填写你设定的key
            'encodingaeskey'=>$opt['encodingaeskey'], //填写加密用的EncodingAESKey
            'appid'=>$opt['appid'], //填写高级调用功能的app id
            'appsecret'=>$opt['appsecret'] //填写高级调用功能的密钥
        );
//        dump($opt);die;
        $this->obj = new \Org\Wechat\Thinkphp\TPWechat($opt);
    }
}